# -*- coding: utf-8 -*-
"""
Created on Mon Nov 14 17:11:04 2022

@author: YSL
"""
words1="One is always on a strange road, watching strange scenery and listening \
to strange music. Then one day, you will find that the things you try hard to forget \
are already gone."
words2="The Fluidic Propulsive System is scalable and can be used to power a range \
of aircraft for both VTOL and STOL applications. Jetoptera licenses and sells its \
patented propulsion system. In conjunction with partners, Jetoptera is building unmanned \
and, eventually, manned aircraft."


num=len(words1)

a=list(words1)

word=[0]*num

#print(a[1],type(a[1]),type(a))
#print(b[1],type(b[1]),type(b))

for i in range(num):
    if(not(96<ord(a[i])<123 or 64<ord(a[i])<91)):#非字母检查
#        print("非字母统计 %s" % a[i])
        if (i<num-1 and (96<ord(a[i+1])<123 or 64<ord(a[i+1])<91)):  #单词检查
            word[i+1]=1
if (96<ord(a[0])<123 or 64<ord(a[0])<91):
    word[0]=1

all=0
for i in range(num):
    all=all+word[i]

print("这句话总共有%d个单词" % all)
